package cn.tansanqinger.DesignMode.Singleton;

class Message2{
    private Message2(){
        System.out.println("构造方法");
    }
    private static Message2 message2 = null;
    public static Message2 getInstance(){
        if(message2==null){
            message2 = new Message2();
        }
        return message2;
    }
    public void printf(){
        System.out.println("C3H2");
    }
}
public class LazySingleton {
    public static void main(String[] args) {
        Message2 messageA = Message2.getInstance();
        Message2 messageB = Message2.getInstance();
        messageA.printf();
        messageB.printf();
    }
}
